1. Field of the Invention
This invention relates in general to computer-implemented database management systems, and, in particular, to a technique for creating a unique item identification number.
2. Description of Related Art
The Internet is a collection of computer networks that exchange information via Transmission Control Protocol/Internet Protocol (xe2x80x9cTCP/IPxe2x80x9d). The Internet computer network consists of many Internet networks, each of which is a single network that uses the TCP/IP protocol suite. Currently, the use of the Internet computer network for commercial and noncommercial uses is exploding. Via its networks, the Internet computer network enables many users in different locations to access information stored in data sources (e.g., databases) stored in different locations.
The World Wide Web (i.e., the xe2x80x9cWWWxe2x80x9d or the xe2x80x9cWebxe2x80x9d) is a hypertext information and communication system used on the Internet computer network with data communications operating according to a client/server model. Typically, a Web client computer will request data stored in data sources from a Web server computer, at which Web server software resides. The Web server software interacts with an interface connected to, for example, a Database Management System (xe2x80x9cDBMSxe2x80x9d), which is connected to the data sources. These computer programs residing at the Web server computer will retrieve the data and transmit the data to the client computer. The data can be any type of information, including database data, static data, HTML data, or dynamically generated data.
With the fast growing popularity of the Internet and the World Wide Web (also known as xe2x80x9cWWWxe2x80x9d or the xe2x80x9cWebxe2x80x9d), there is also a fast growing demand for Web access to databases. In particular, databases on the Web are often used to store items, such as images, text files, and audio files. After the items are stored, users may attempt to access the items from the databases. To prevent conflicts between users that desire to access an item, each item has an identification number.
In conventional database systems, the identification number is generated by using a random number generator. Input into the random number generator, referred to as a xe2x80x9cseedxe2x80x9d value, is typically a computer-dependent timestamp value. The computer-dependent timestamp value is related to a time-of-day (xe2x80x9cTODxe2x80x9d) clock value. In most computers, the TOD clock is incremented once every one hundredth of a second. The seed value is input into a random number generator, and the random number generator outputs a random number. This random number is used to create the item identification number.
The item identification number is created by mapping the random number into a character string. A user or software developer can define the length of the character string. To increase the length of the character string, a user can invoke the random number generator multiple times and append the consecutive random numbers together. These appended random numbers are mapped into a character string. The user may continue to invoke the random number generator until a desired character string length is achieved.
Although the random number generator produces a random number, it may not be unique because a single seed value will always produce the same random number (or the same sequence of random numbers when the random number generator is invoked multiple times). To clarify, when a particular seed value is input into a random number generator, the random number generator outputs a random number that is associated with that particular seed value. For example, suppose a seed value of 113601 is input into a random number generator, and suppose the random number generator outputs a random number value of 472. The random number generator will always produce a random number value of 472 when the seed value of 113601 is entered. Consequently, when multiple items are produced at the exact same instant in time, such that each item has the exact same timestamp, then, the random number generator uses the same timestamp to generate item identification numbers, and hence, generates non-unique item identification numbers. The random numbers are non-unique because the same timestamp value was used as the seed. Since the random number is used to create the identification number, the identification number is also non-unique.
Several scenarios may produce a single timestamp for multiple items. For instance, multiple users may create an item to store in a database at the same instant in time. The random number generator will use a single timestamp value to create the random number. Accordingly, each item may have the exact same identification number.
Similar outcomes may be produced when multiple processes (also referred to as tasks) are executed at the same instant in time. For the examples used, a process is an executing software program, but one skilled in the art may recognize other definitions for processes. Like the items created by multiple users, the items created by multiple processes may each have the exact same identification number. Comparable results may occur when multiple threads are executed at the same instant in time. As used in the following examples, a thread is a part of a software program that can be executed independently of other parts of the software program. Like the items created by multiple users and the items created by multiple processes, the items created by multiple threads may each have the exact same identification number.
When multiple items that have the same identification number exist in a database, the system can fail because the system may be incapable of distinguishing between the multiple items. That is, the system may lack the ability to identify a correct item to return in response to a request for an item with a particular item identification number.
Thus, there is a need in the art for generating unique item identification numbers, and hence, reducing the number of system failures.
To overcome the limitations in the prior art described above, and to overcome other limitations that will become apparent upon reading and understanding the present specification, the present invention discloses a method, apparatus, and article of manufacture for generating an item identification number within a computer. An item identification number is associated with an item stored in a database connected to a computer.
In accordance with the present invention, a unique seed value is created, wherein the unique seed value comprises a computer-dependent timestamp and one or more unique identifiers. A unique item identification number is produced by inputting the unique seed value into a random number generator.